package com.ambulance.project.biz.util;

import java.io.File;
import java.io.FilenameFilter;

/**
 * @Author RXL
 * @Date 2020/7/13 0:11
 * @Version 1.0
 */
public class ScanFileUtil {

    public static File getTargetFile(String dispathID, final String tag)
    {
        String baseUrl = "/home/amb/uploadPath/videoPath/" + dispathID;
        File myDir = new File(baseUrl);
        File targetFile = null;
        if (myDir.isDirectory())
        {
            File[] files = myDir.listFiles(new FilenameFilter()
            {
                @Override
                public boolean accept(File dir, String name)
                {
                    return name.endsWith(tag);
                }
            });

            if (null != files && files.length > 0)
            {
                targetFile = files[0];
            }
        }

        return targetFile;
    }
}
